package com.zoroki.student_score_system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zoroki.student_score_system.domain.Semester;
import com.zoroki.student_score_system.service.SemesterService;
import com.zoroki.student_score_system.mapper.SemesterMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【semester】的数据库操作Service实现
* @createDate 2025-06-30 12:49:22
*/
@Service
public class SemesterServiceImpl extends ServiceImpl<SemesterMapper, Semester>
    implements SemesterService{
    @Autowired
    private SemesterMapper semesterMapper;

    @Override
    public List<Semester> findAllSemesters() {
        return semesterMapper.selectList(null);
    }

    @Override
    public Semester findSemesterById(int id) {
        return semesterMapper.selectById(id);
    }

    @Override
    public boolean deleteSemester(int id) {
        return semesterMapper.deleteById(id) > 0;
    }

    @Override
    public boolean updateSemester(Semester semester) {
        return semesterMapper.updateById(semester) > 0;
    }

    @Override
    public boolean addSemester(Semester semester) {
        return semesterMapper.insert(semester) > 0;
    }
}




